package ld.oauth.blog.mapper.article;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import ld.oauth.blog.model.po.article.Article;
import ld.oauth.blog.model.qo.ArticleQo;
import ld.oauth.blog.model.vo.ArticleDetail;
import ld.oauth.blog.model.vo.ArticleVo;
import ld.oauth.blog.model.vo.CommentVo;
import ld.oauth.blog.model.vo.LabelVo;
import ld.oauth.blog.utils.PageResult;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ld
 * @since 2022-09-24
 */
public interface ArticleMapper extends BaseMapper<Article> {

    /**
     * 分页条件查询文章列表
     * @param articleQo
     * @param page
     * @return
     */
    PageResult<ArticleVo> pageQuery(@Param("articleQo") ArticleQo articleQo, @Param("page") IPage<ArticleVo> page);

    /**
     * 根据文章id查询标签集合
     * @param articleId
     * @return
     */
    List<LabelVo> selectLabelVoListByArticleId(@Param("articleId")Integer articleId);

    /**
     * 根据文章id获取评论list
     * @param articleId
     * @return
     */
    List<CommentVo> commentListByArticleIdOrParentId(@Param("articleId")Integer articleId,@Param("parentId")Integer parentId);

    /**
     * 根据标签id分页查询文章列表
     * @param articleQo
     * @param page
     * @return
     */
    PageResult<ArticleDetail> queryArticleDetailByLabelId(@Param("articleQo")ArticleQo articleQo, @Param("page")IPage<ArticleDetail> page);


}
